# class Human:
#     def __init__(self, name, sex):
#         self.name = name
#         self.sex = sex
#         self.num_eyes = 2  # 两只眼睛
#         self.has_tail = False  # 没有尾巴
#
#     def breath(self):
#         print(self.name + "在呼吸…")
#
#     def poop(self):
#         print(self.name + "在拉屎…")
#
#     def read(self):
#         print(self.name + "在阅读…")
#
#
# class Cat:
#     def __init__(self, name, sex):
#         self.name = name
#         self.sex = sex
#         self.num_eyes = 2  # 两只眼睛
#         self.has_tail = True  # 有尾巴
#
#     def breath(self):
#         print(self.name + "在呼吸…")
#
#     def poop(self):
#         print(self.name + "在拉屎…")
#
#     def scratch_sofa(self):
#         print(self.name + "在抓沙发…")
# 以上两类都有相同之处,可以使用类继承
class Mammal:
    def __init__(self, name, sex):
        self.name = name
        self.sex = sex
        self.num_eyes = 2

    def breath(self):
        print(self.name + "在呼吸…")

    def poop(self):
        print(self.name + "在拉屎…")


class Human(Mammal):
    def __init__(self, name, sex):
        super().__init__(name, sex)
        self.has_tail = False

    def read(self):
        print(self.name + "在阅读…")


class Cat(Mammal):
    def __init__(self, name, sex):
        super().__init__(name, sex)
        self.has_tail = True

    def scratch_sofa(self):
        print(self.name + "在抓沙发…")

    def poop(self):
        print(self.name + "在猫砂上拉屎…")


cat1 = Cat("Jojo", "男")
cat1.poop()  # 优先看所属的类有没有该方法


# 类继承练习:人力系统
# – 员工分为两类:全职员工 FullTimeEmployee、兼职员工 PartTimeEmployee。
# – 全职和兼职都有"姓名name"、"工号id"属性，
#   都具备"打印信息 print_info"(打印姓名、工号）方法。
# – 全职有"月薪monthly_salary"属性，
#   兼职有"日薪daily_salary"属性、"每月工作天数 work_days"的属性。
# – 全职和兼职都有"计算月薪calculate_monthly_pay"的方法，但具体计算过程不一样。

class Employee:
    def __init__(self, name, employee_id):
        self.name = name
        self.employee_id = employee_id

    def print_info(self):
        print(f"员工名字：{self.name}，工号：{self.employee_id}")


class FullTimeEmployee(Employee):
    def __init__(self, name, employee_id, monthly_salary):
        super().__init__(name, employee_id)
        self.monthly_salary = monthly_salary

    def calculate_monthly_pay(self):
        return self.monthly_salary


class PartTimeEmployee(Employee):
    def __init__(self, name, employee_id, daily_salary, work_days):
        super().__init__(name, employee_id)
        self.daily_salary = daily_salary
        self.work_days = work_days

    def calculate_monthly_pay(self):
        return self.daily_salary * self.work_days


ZhangSan = FullTimeEmployee("张三", "1001", 6000)
LiSi = PartTimeEmployee("李四", "1002", 230, 15)
ZhangSan.print_info()
LiSi.print_info()
print(ZhangSan.calculate_monthly_pay())
print(LiSi.calculate_monthly_pay())
